import {
  Column,
  CreateDateColumn,
  Entity,
  PrimaryGeneratedColumn,
} from 'typeorm';

@Entity('tb_rate', {
  comment: '评价表',
})
export class Rate {
  @PrimaryGeneratedColumn('increment', { comment: '自增主键', unsigned: true })
  id: number;

  @Column({ comment: '用户ID' })
  userId: number;

  @Column({ comment: '商品ID' })
  productId: number;

  @Column({ comment: '订单ID' })
  orderId: number;

  @Column({ comment: '商品规格' })
  spec: string;

  @Column({ comment: '星级评分', unsigned: true, type: 'tinyint', default: 5 })
  star: number;

  @Column({ comment: '文字评价', type: 'text', nullable: true })
  content: string;

  @Column({ comment: '是否匿名', type: 'tinyint', default: false })
  anonymous: boolean;

  @Column({ comment: '是否显示', type: 'tinyint', default: true })
  display: boolean;

  @Column({ comment: '评价附件', nullable: true })
  annexs: string;

  @CreateDateColumn({ comment: '评价时间' })
  time: Date;
}
